﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Collections;
using GPCSC.Web;
using NickLee.Common;
using System.Text;

namespace GPCSC.Web.sjs
{
    public partial class newadlist : PageBase
    {

        public double[] ad = new double[23];
        public StringBuilder[] adds = new StringBuilder[23];
        public string add = "0";


        public double[] su = new double[23];
        public StringBuilder[] sums = new StringBuilder[23];
        public string sum = "0";



        public string cout = "";
        protected void Page_Load(object sender, EventArgs e)
        {

            for (int i = 0; i < 23; i++)
            {
                adds[i] = new StringBuilder();
                sums[i] = new StringBuilder();

            }
            if (!IsPostBack)
            {


                load();

            }
        }
        protected void load()
        {
            //byte[] userInfo = (byte[])base.o_baseTable[c_obj.s_userInfo];
            //Hashtable userInfoTable = CompressData.UnCompressHashtable(userInfo);
            //Model.CL_USER_S users = (Model.CL_USER_S)userInfoTable["SYS_USER"];
            //string postid = this.Text1.Value;
            //string postname =this.dw.Value;
            //f_buildGrid(postid, postname);
            //f_buildGrids(postid);//合计

        }
        protected void f_buildGrid(string postid, string postname)
        {
            this.postid.Value = postid;
            this.postName.Value = postname;

            Hashtable htable = new Hashtable();
            htable.Add("@CL_POST_SOID", postid);
            DataSet dsname = new DataReturn().ReturnData(htable, "newSelAll");
            cout = dsname.Tables[0].Rows.Count.ToString();
            if (dsname != null)
            {
                if (dsname.Tables.Count > 0)
                {
                    if (dsname.Tables[0].Rows.Count > 0)
                    {
                        PostListS.DataSource = dsname;
                        PostListS.DataBind();
                        //循环遍历每个领导人
                        foreach (DataRow dr in dsname.Tables[0].Rows)
                        {
                            string userid = dr["CL_USER_SOID"].ToString();
                            Hashtable htables = new Hashtable();
                            htables.Add("@lgid", userid);
                            DataSet ds = new SqlReadXml().ReaderDataSet("newSelAllbyuserid", htables);
                            if (ds != null)
                            {
                                if (ds.Tables.Count > 0)
                                {
                                    if (ds.Tables[0].Rows.Count > 0)
                                    {
                                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                        {
                                            ad[0] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["XJCDYTS"]);//下基层
                                            ad[1] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZXMQRJPS"]);//民情
                                            ad[2] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZCRHTS"]);//走村入户
                                            ad[3] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDZHTS"]);//驻点住户
                                            ad[4] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["GKJFTS"]);//公开接访天数
                                            ad[5] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["JDXFAJ"]);//接待信访件数
                                            ad[6] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["yjaxf"]);//已结案

                                            ad[7] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDXFBAJS"]);
                                            ad[8] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDXFBAJWCS"]);
                                            ad[9] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["KNQZZHS"]);
                                            ad[10] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["GGJDHS"]);
                                            ad[11] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WWKNQZQK_YZFHS"]);
                                            ad[12] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["YBFHS"]);
                                            ad[13] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WWJZZHLJJE"]);
                                            ad[14] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZKZTHCS"]);
                                            ad[15] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["Z_CJRC"]);
                                            ad[16] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["XSZCXJCS"]);
                                            ad[17] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["X_CJRC"]);
                                            ad[18] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["CJLDTS"]);
                                            ad[19] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WJCDWQZBSSZJS"]);
                                            ad[20] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WJCDWFCZJLJJE"]);
                                        }
                                        for (int i = 0; i < 21; i++)
                                        {
                                            adds[i].Append("<td  class=\"td\" >" + ad[i].ToString() + "</td>");
                                            su[i] += ad[i];
                                            ad[i] = 0;
                                        }
                                    }
                                    else
                                    {
                                        for (int m = 0; m < 21; m++)
                                        {

                                            ad[m] = 0;
                                            adds[m].Append("<td  class=\"td\" >" + add + "</td>");
                                        }
                                    }
                                }
                            }
                            //问题及解决情况统计
                            int wts = 0;
                            DataSet dwts = new SqlReadXml().ReaderDataSet("countWT", htables);
                            if (dwts.Tables[0].Rows.Count > 0)
                            {
                                wts = Usual.f_convertInt32(dwts.Tables[0].Rows[0]["wts"].ToString());
                            }
                            adds[21].Append("<td  class=\"td\" >" + wts.ToString() + "</td>");
                            su[21] += wts;

                            int jwts = 0;
                            DataSet jdwts = new SqlReadXml().ReaderDataSet("countjjWT", htables);
                            if (jdwts.Tables[0].Rows.Count > 0)
                            {
                                jwts = Usual.f_convertInt32(jdwts.Tables[0].Rows[0]["jwts"].ToString());
                            }
                            adds[22].Append("<td  class=\"td\" >" + jwts.ToString() + "</td>");
                            su[22] += jwts;



                        }
                        //合计值
                        for (int i = 0; i < 23; i++)
                        {

                            sums[i].Append("<td  class=\"td\" >" + su[i].ToString() + "</td>");
                        }
                    }
                }
            }
        }
        protected void CallBack1_Callback(object sender, NickLee.Web.UI.CallBackEventArgs e)
        {
            try
            {
                string types = e.Parameters[0].ToString();
                if (types == "1")//按季度
                {
                    string lgname = e.Parameters[1].ToString();
                    int jd = Usual.f_convertInt32(e.Parameters[2].ToString());
                    int kmonth = 0;
                    int jmonth = 0;
                    switch (jd)
                    {
                        case 1:
                            kmonth = 1;
                            jmonth = 3;
                            break;
                        case 2:
                            kmonth = 4;
                            jmonth = 6;
                            break;
                        case 3:
                            kmonth = 7;
                            jmonth = 9;
                            break;
                        default:
                            kmonth = 10;
                            jmonth = 12;
                            break;
                    }
                    kbymont(lgname, kmonth, jmonth);

                }
                else if (types == "2")//按月份
                {
                    string lgname = e.Parameters[1].ToString();
                    int kmonth = Usual.f_convertInt32(e.Parameters[2].ToString());
                    int jmonth = Usual.f_convertInt32(e.Parameters[3].ToString());
                    kbymont(lgname, kmonth, jmonth);

                }
                #region 只按领导人姓名查询
                else
                {
                    string lgname = e.Parameters[1].ToString().Trim();
                    lgname = "%" + lgname + "%";
                    Hashtable htable = new Hashtable();
                    htable.Add("@CL_POST_SOID", this.postid.Value);
                    htable.Add("@USERNAME", lgname);
                    DataSet dsname = new DataReturn().ReturnData(htable, "newSelAll_m");
                    cout = dsname.Tables[0].Rows.Count.ToString();
                    if (dsname != null)
                    {
                        if (dsname.Tables.Count > 0)
                        {
                            if (dsname.Tables[0].Rows.Count > 0)
                            {
                                PostListS.DataSource = dsname;
                                PostListS.DataBind();
                                //循环遍历每个领导人
                                foreach (DataRow dr in dsname.Tables[0].Rows)
                                {
                                    string userid = dr["CL_USER_SOID"].ToString();
                                    Hashtable htables = new Hashtable();
                                    htables.Add("@lgid", userid);
                                    DataSet ds = new SqlReadXml().ReaderDataSet("newSelAllbyuserid", htables);
                                    if (ds != null)
                                    {
                                        if (ds.Tables.Count > 0)
                                        {
                                            if (ds.Tables[0].Rows.Count > 0)
                                            {
                                                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                                {
                                                    ad[0] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["XJCDYTS"]);//下基层
                                                    ad[1] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZXMQRJPS"]);//民情
                                                    ad[2] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZCRHTS"]);//走村入户
                                                    ad[3] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDZHTS"]);//驻点住户
                                                    ad[4] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["GKJFTS"]);//公开接访天数
                                                    ad[5] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["JDXFAJ"]);//接待信访件数
                                                    ad[6] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["yjaxf"]);//已结案

                                                    ad[7] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDXFBAJS"]);
                                                    ad[8] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDXFBAJWCS"]);
                                                    ad[9] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["KNQZZHS"]);
                                                    ad[10] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["GGJDHS"]);
                                                    ad[11] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WWKNQZQK_YZFHS"]);
                                                    ad[12] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["YBFHS"]);
                                                    ad[13] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WWJZZHLJJE"]);
                                                    ad[14] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZKZTHCS"]);
                                                    ad[15] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["Z_CJRC"]);
                                                    ad[16] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["XSZCXJCS"]);
                                                    ad[17] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["X_CJRC"]);
                                                    ad[18] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["CJLDTS"]);
                                                    ad[19] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WJCDWQZBSSZJS"]);
                                                    ad[20] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WJCDWFCZJLJJE"]);
                                                }
                                                for (int i = 0; i < 21; i++)
                                                {
                                                    adds[i].Append("<td  class=\"td\" >" + ad[i].ToString() + "</td>");
                                                    su[i] += ad[i];
                                                    ad[i] = 0;
                                                }
                                            }
                                            else
                                            {
                                                for (int m = 0; m < 21; m++)
                                                {

                                                    ad[m] = 0;
                                                    adds[m].Append("<td  class=\"td\" >" + add + "</td>");
                                                }
                                            }
                                        }
                                    }
                                    //问题及解决情况统计
                                    int wts = 0;
                                    DataSet dwts = new SqlReadXml().ReaderDataSet("countWT", htables);
                                    if (dwts.Tables[0].Rows.Count > 0)
                                    {
                                        wts = Usual.f_convertInt32(dwts.Tables[0].Rows[0]["wts"].ToString());
                                    }
                                    adds[21].Append("<td  class=\"td\" >" + wts.ToString() + "</td>");
                                    su[21] += wts;

                                    int jwts = 0;
                                    DataSet jdwts = new SqlReadXml().ReaderDataSet("countjjWT", htables);
                                    if (jdwts.Tables[0].Rows.Count > 0)
                                    {
                                        jwts = Usual.f_convertInt32(jdwts.Tables[0].Rows[0]["jwts"].ToString());
                                    }
                                    adds[22].Append("<td  class=\"td\" >" + jwts.ToString() + "</td>");
                                    su[22] += jwts;



                                }
                                //合计值
                                for (int i = 0; i < 23; i++)
                                {

                                    sums[i].Append("<td  class=\"td\" >" + su[i].ToString() + "</td>");
                                }
                            }
                        }
                    }

                }
                #endregion
            }
            catch (Exception ee)
            {

            }
            finally
            {
                Panel1.RenderControl(e.Output);
            }
        }



        //汇总上报
        protected void LCallBack_Callback(object sender, NickLee.Web.UI.CallBackEventArgs e)
        {
            try
            {
                Hashtable htable = new Hashtable();
                htable.Add("@CL_POST_SOID", this.postid.Value);
                DataSet dsname = new DataReturn().ReturnData(htable, "newSelAll");
                cout = dsname.Tables[0].Rows.Count.ToString();
                if (dsname != null)
                {
                    if (dsname.Tables.Count > 0)
                    {
                        if (dsname.Tables[0].Rows.Count > 0)
                        {
                            //循环遍历每个领导人
                            foreach (DataRow dr in dsname.Tables[0].Rows)
                            {
                                string userid = dr["CL_USER_SOID"].ToString();
                                Hashtable htables = new Hashtable();
                                htables.Add("@lgid", userid);
                                htables.Add("@year", DateTime.Now.Year);
                                htables.Add("@month", DateTime.Now.Month);
                                DataSet ds = new SqlReadXml().ReaderDataSet("newSelAllbyuserid_m", htables);
                                if (ds != null)
                                {
                                    if (ds.Tables.Count > 0)
                                    {
                                        if (ds.Tables[0].Rows.Count > 0)
                                        {
                                            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                            {
                                                ad[0] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["XJCDYTS"]);//下基层
                                                ad[1] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZXMQRJPS"]);//民情
                                                ad[2] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZCRHTS"]);//走村入户
                                                ad[3] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDZHTS"]);//驻点住户
                                                ad[4] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["GKJFTS"]);//公开接访天数
                                                ad[5] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["JDXFAJ"]);//接待信访件数
                                                ad[6] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["yjaxf"]);//已结案

                                                ad[7] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDXFBAJS"]);
                                                ad[8] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDXFBAJWCS"]);
                                                ad[9] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["KNQZZHS"]);
                                                ad[10] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["GGJDHS"]);
                                                ad[11] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WWKNQZQK_YZFHS"]);
                                                ad[12] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["YBFHS"]);
                                                ad[13] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WWJZZHLJJE"]);
                                                ad[14] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZKZTHCS"]);
                                                ad[15] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["Z_CJRC"]);
                                                ad[16] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["XSZCXJCS"]);
                                                ad[17] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["X_CJRC"]);
                                                ad[18] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["CJLDTS"]);
                                                ad[19] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WJCDWQZBSSZJS"]);
                                                ad[20] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WJCDWFCZJLJJE"]);
                                            }
                                            for (int i = 0; i < 21; i++)
                                            {
                                                //adds[i].Append("<td  class=\"td\" >" + ad[i].ToString() + "</td>");
                                                su[i] += ad[i];
                                                ad[i] = 0;
                                            }
                                        }
                                        else
                                        {
                                            for (int m = 0; m < 21; m++)
                                            {

                                                ad[m] = 0;
                                                adds[m].Append("<td  class=\"td\" >" + add + "</td>");
                                            }
                                        }
                                    }
                                }
                                //问题及解决情况统计
                                int wts = 0;
                                DataSet dwts = new SqlReadXml().ReaderDataSet("countWT_m", htables);
                                if (dwts.Tables[0].Rows.Count > 0)
                                {
                                    wts = Usual.f_convertInt32(dwts.Tables[0].Rows[0]["wts"].ToString());
                                }
                                //adds[21].Append("<td  class=\"td\" >" + wts.ToString() + "</td>");
                                su[21] += wts;

                                int jwts = 0;
                                DataSet jdwts = new SqlReadXml().ReaderDataSet("countjjWT_m", htables);
                                if (jdwts.Tables[0].Rows.Count > 0)
                                {
                                    jwts = Usual.f_convertInt32(jdwts.Tables[0].Rows[0]["jwts"].ToString());
                                }
                                //adds[22].Append("<td  class=\"td\" >" + jwts.ToString() + "</td>");
                                su[22] += jwts;



                            }
                            //上报合计值
                            Hashtable hzhatable = new Hashtable();
                            hzhatable.Add("postid", this.postid.Value);
                            hzhatable.Add("postName", this.postName.Value);
                            hzhatable.Add("xjc", su[0]);
                            hzhatable.Add("mqri", su[1]);
                            hzhatable.Add("zzrh", su[2]);
                            hzhatable.Add("zdzh", su[3]);
                            hzhatable.Add("gkjf", su[4]);
                            hzhatable.Add("jfxj", su[5]);
                            hzhatable.Add("yjaxf", su[6]);
                            hzhatable.Add("zdxfbajs", su[7]);
                            hzhatable.Add("zdxfbawcjs", su[8]);
                            hzhatable.Add("knqzzhs", su[9]);
                            hzhatable.Add("ggjdhs", su[10]);
                            hzhatable.Add("zzfhs", su[11]);
                            hzhatable.Add("ybfhs", su[12]);
                            hzhatable.Add("wedsd", su[13]);
                            hzhatable.Add("fdagr", su[14]);
                            hzhatable.Add("jffdbhxj", su[15]);
                            hzhatable.Add("jfvdxj", su[16]);
                            hzhatable.Add("jfsdxsj", su[17]);
                            hzhatable.Add("jfsdxj", su[21]);
                            hzhatable.Add("jfxcvj", su[22]);
                            hzhatable.Add("cjldcs", su[18]);
                            hzhatable.Add("jfxvcj", su[19]);
                            hzhatable.Add("jfxdsj", su[20]);
                            hzhatable.Add("year", DateTime.Now.Year.ToString());
                            hzhatable.Add("month", DateTime.Now.Month.ToString());
                            SQLServerDAL.databyhtable dh = new SQLServerDAL.databyhtable();

                            Hashtable htsd = new Hashtable();
                            htsd.Add("@postid", this.postid.Value);
                            htsd.Add("@year", DateTime.Now.Year.ToString());
                            htsd.Add("@month", DateTime.Now.Month.ToString());

                            DataSet dsw = new DataSet();
                            dsw = new SqlReadXml().ReaderDataSet("sel_sjhz_byym", htsd);
                            if (dsw.Tables[0].Rows.Count > 0)
                            {
                                dh.databyhtables(hzhatable, "update", "sjhz", "tableid", dsw.Tables[0].Rows[0]["tableid"].ToString());
                            }
                            else
                            {
                                dh.databyhtables(hzhatable, "add", "sjhz", "", "");
                            }
                        }
                    }
                }

            }
            catch (Exception ee)
            {
                throw ee;
            }
            finally
            {
                //load();
                LPanel.RenderControl(e.Output);
            }
        }


        //按月份查询
        protected void kbymont(string lgname, int kmonth, int jmonth)
        {

            lgname = "%" + lgname + "%";
            Hashtable htable = new Hashtable();
            htable.Add("@CL_POST_SOID", this.postid.Value);
            htable.Add("@USERNAME", lgname);
            DataSet dsname = new DataReturn().ReturnData(htable, "newSelAll_m");
            cout = dsname.Tables[0].Rows.Count.ToString();
            if (dsname != null)
            {
                if (dsname.Tables.Count > 0)
                {
                    if (dsname.Tables[0].Rows.Count > 0)
                    {
                        PostListS.DataSource = dsname;
                        PostListS.DataBind();
                        //循环遍历每个领导人
                        foreach (DataRow dr in dsname.Tables[0].Rows)
                        {
                            string userid = dr["CL_USER_SOID"].ToString();
                            Hashtable htables = new Hashtable();
                            htables.Add("@lgid", userid);
                            htables.Add("@year", DateTime.Now.Year);
                            htables.Add("@kmonth", kmonth);
                            htables.Add("@jmonth", jmonth);
                            DataSet ds = new SqlReadXml().ReaderDataSet("newSelAllbyuserid_km", htables);
                            if (ds != null)
                            {
                                if (ds.Tables.Count > 0)
                                {
                                    if (ds.Tables[0].Rows.Count > 0)
                                    {
                                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                        {
                                            ad[0] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["XJCDYTS"]);//下基层
                                            ad[1] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZXMQRJPS"]);//民情
                                            ad[2] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZCRHTS"]);//走村入户
                                            ad[3] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDZHTS"]);//驻点住户
                                            ad[4] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["GKJFTS"]);//公开接访天数
                                            ad[5] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["JDXFAJ"]);//接待信访件数
                                            ad[6] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["yjaxf"]);//已结案

                                            ad[7] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDXFBAJS"]);
                                            ad[8] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZDXFBAJWCS"]);
                                            ad[9] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["KNQZZHS"]);
                                            ad[10] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["GGJDHS"]);
                                            ad[11] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WWKNQZQK_YZFHS"]);
                                            ad[12] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["YBFHS"]);
                                            ad[13] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WWJZZHLJJE"]);
                                            ad[14] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["ZKZTHCS"]);
                                            ad[15] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["Z_CJRC"]);
                                            ad[16] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["XSZCXJCS"]);
                                            ad[17] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["X_CJRC"]);
                                            ad[18] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["CJLDTS"]);
                                            ad[19] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WJCDWQZBSSZJS"]);
                                            ad[20] += Usual.f_convertDobule(ds.Tables[0].Rows[i]["WJCDWFCZJLJJE"]);
                                        }
                                        for (int i = 0; i < 21; i++)
                                        {
                                            adds[i].Append("<td  class=\"td\" >" + ad[i].ToString() + "</td>");
                                            su[i] += ad[i];
                                            ad[i] = 0;
                                        }
                                    }
                                    else
                                    {
                                        for (int m = 0; m < 21; m++)
                                        {

                                            ad[m] = 0;
                                            adds[m].Append("<td  class=\"td\" >" + add + "</td>");
                                        }
                                    }
                                }
                            }
                            //问题及解决情况统计
                            int wts = 0;
                            DataSet dwts = new SqlReadXml().ReaderDataSet("countWT_km", htables);
                            if (dwts.Tables[0].Rows.Count > 0)
                            {
                                wts = Usual.f_convertInt32(dwts.Tables[0].Rows[0]["wts"].ToString());
                            }
                            adds[21].Append("<td  class=\"td\" >" + wts.ToString() + "</td>");
                            su[21] += wts;

                            int jwts = 0;
                            DataSet jdwts = new SqlReadXml().ReaderDataSet("countjjWT_km", htables);
                            if (jdwts.Tables[0].Rows.Count > 0)
                            {
                                jwts = Usual.f_convertInt32(jdwts.Tables[0].Rows[0]["jwts"].ToString());
                            }
                            adds[22].Append("<td  class=\"td\" >" + jwts.ToString() + "</td>");
                            su[22] += jwts;



                        }
                        //合计值
                        for (int i = 0; i < 23; i++)
                        {

                            sums[i].Append("<td  class=\"td\" >" + su[i].ToString() + "</td>");
                        }
                    }
                }
            }
        }
    }
}